import Vue from "vue";
import App from "./App";
import { router, RouterMount } from "./router";
import uView from "uview-ui";
import store from "./store";
import { myTool } from "./utils/tool";
import filters from "@/utils/filters";
import widget from "@/service/api/sp-common/widget";
import theme from "@/const/theme";
import { getUserLocation, getCurrentLocation } from "@/utils/location";
import lowCodePage from "low_code_base_pub_merch/components/lc/lc-page";
import lowCodeComponents from "low_code_base_pub_merch/components/lc/lc-components";
import xhImg from "./components/baseComponents/xh-img";
import NavBar from "@/components/baseComponents/nav-bar";
import Modal from "@/components/baseComponents/modal";
import AuthPage from "@/components/baseComponents/auth-page";
import CusTabbar from "@/components/baseComponents/yqd-cus-tabbar/index.vue";
import ListEnpty from "@/components/baseComponents/list-enpty/index.vue";

Vue.config.productionTip = false;
Vue.prototype.$myTool = myTool; //工具包
Vue.prototype.$store = store; //vuex
Vue.prototype.$pay = (storeInfo) =>
  store.dispatch("sp-common/pay/pay", storeInfo);
Vue.prototype.$getUserLocation = getUserLocation; //定位信息
Vue.prototype.$getCurrentLocation = getCurrentLocation; //当前定位信息
Vue.prototype.$widget = widget; //低代码相关接口
Vue.prototype.$theme = theme; //相关主题色，请看对应代码使用
App.mpType = "app";
Vue.component("xhImg", xhImg);
Vue.component("NavBar", NavBar);
Vue.component("Modal", Modal);
Vue.component("CusTabbar", CusTabbar);
Vue.component("AuthPage", AuthPage);
Vue.component("lowCodePage", lowCodePage);
Vue.component("lowCodeComponents", lowCodeComponents);
Vue.component("ListEnpty", ListEnpty);
Vue.use(router);
Vue.use(uView);

//过滤器
Object.keys(filters).forEach((k) => Vue.filter(k, filters[k]));
const app = new Vue({
  store,
  ...App,
});
// app.$mount();

//v1.3.5起 H5端 你应该去除原有的app.$mount();使用路由自带的渲染方式
// #ifdef H5
RouterMount(app, "#app");
// #endif

// #ifndef H5
app.$mount(); //为了兼容小程序及app端必须这样写才有效果
// #endif
export default app;
